﻿using System;
namespace Producers.Kis.Xtee.Riik.Ee.Producer.Kis {
    
    
    public class ContactType : global::Xtee.Core.Schema.XsdInteger {
        
        public const decimal LAUATELEFON = 1;
        
        public const decimal MOBIILTELEFON = 2;
        
        public const decimal FAKS = 3;
        
        public const decimal EPOST = 4;
        
        public const decimal MUU = 5;
        
        public ContactType(decimal value) : 
                base(value) {
            this.Pattern = @"(1|2|3|4|5)";
            this.Validate();
            string annot = null;
            if (Value == 1) {
                annot = "lauatelefon";
            }
            if (Value == 2) {
                annot = "mobiiltelefon";
            }
            if (Value == 3) {
                annot = "faks";
            }
            if (Value == 4) {
                annot = "e-post";
            }
            if (Value == 5) {
                annot = "muu";
            }
            if (annot!=null) {
                this._annotation = annot;
            }
            else {
                throw new global::Xtee.Core.Types.XteeSimpleTypeValidationException(string.Format("Enumeration on [{0}] does not allow value : [{1}] ", this.GetType().Name,Value.ToString()));;
            }
        }
        
        public ContactType(string value) : 
                base(value) {
            this.Pattern = @"(1|2|3|4|5)";
            this.Validate();
            string annot = null;
            if (Value == 1) {
                annot = "lauatelefon";
            }
            if (Value == 2) {
                annot = "mobiiltelefon";
            }
            if (Value == 3) {
                annot = "faks";
            }
            if (Value == 4) {
                annot = "e-post";
            }
            if (Value == 5) {
                annot = "muu";
            }
            if (annot!=null) {
                this._annotation = annot;
            }
            else {
                throw new global::Xtee.Core.Types.XteeSimpleTypeValidationException(string.Format("Enumeration on [{0}] does not allow value : [{1}] ", this.GetType().Name,Value.ToString()));;
            }
        }
        
        public ContactType() : 
                base(new decimal()) {
        }
        
        public static bool TryParse(string value, out global::Producers.Kis.Xtee.Riik.Ee.Producer.Kis.ContactType result) {
            try {
                result = new global::Producers.Kis.Xtee.Riik.Ee.Producer.Kis.ContactType(value);
                return true;
            }
            catch (System.Exception ) {
                result = null;
                return false;
            }
        }
        
        public static implicit operator Decimal (ContactType value) {
            return value.Value;
        }
        
        public static implicit operator ContactType (decimal value) {
            return new ContactType(value);
        }
    }
}
